package com.joesem.sale.client.network.data

import android.os.Parcel
import android.os.Parcelable

/**
 * @Time 2023/2/22 14:54:14
 * @Description
 **/

class ProductMode(
    val address: String? = null,
    val attachment: String? = null,
    val attachment_url: String? = null,
    val city_id: Int? = null,
    val city_name: String? = null,
    val country_id: Int? = null,
    val country_name: String? = null,
    val county_id: Int? = null,
    val county_name: String? = null,
    val create_time_format: String? = null,
    val create_user_id: Int? = null,
    val customer: Customer? = null,
    val customer_id: Int? = null,
    val date_buy: String? = null,
    val date_check: String? = null,
    val department_id: Int? = null,
    val id: Int? = null,
    val install_address: String? = null,
    val model: String? = null,
    val name: String? = null,
    val product_number: String? = null,
    val province_id: Int? = null,
    val province_name: String? = null,
    val type_id: Int? = null,
    val update_time_format: String? = null,
    val warranty_end: String? = null,
    val warranty_end_date: String? = null,
    val warranty_start: String? = null,
    val warranty_start_date: String? = null,
    val warranty_status_code: String? = null,
    val warranty_status_title: String? = null,
    val warranty_type: String? = null
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readParcelable(Customer::class.java.classLoader),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeString(attachment)
        parcel.writeString(attachment_url)
        parcel.writeValue(city_id)
        parcel.writeString(city_name)
        parcel.writeValue(country_id)
        parcel.writeString(country_name)
        parcel.writeValue(county_id)
        parcel.writeString(county_name)
        parcel.writeString(create_time_format)
        parcel.writeValue(create_user_id)
        parcel.writeParcelable(customer, flags)
        parcel.writeValue(customer_id)
        parcel.writeString(date_buy)
        parcel.writeString(date_check)
        parcel.writeValue(department_id)
        parcel.writeValue(id)
        parcel.writeString(install_address)
        parcel.writeString(model)
        parcel.writeString(name)
        parcel.writeString(product_number)
        parcel.writeValue(province_id)
        parcel.writeString(province_name)
        parcel.writeValue(type_id)
        parcel.writeString(update_time_format)
        parcel.writeString(warranty_end)
        parcel.writeString(warranty_end_date)
        parcel.writeString(warranty_start)
        parcel.writeString(warranty_start_date)
        parcel.writeString(warranty_status_code)
        parcel.writeString(warranty_status_title)
        parcel.writeString(warranty_type)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ProductMode> {
        override fun createFromParcel(parcel: Parcel): ProductMode {
            return ProductMode(parcel)
        }

        override fun newArray(size: Int): Array<ProductMode?> {
            return arrayOfNulls(size)
        }
    }


}

class Customer(
    val address: String? = null,
    val city_id: Int? = null,
    val city_name: String? = null,
    val contact_at: String? = null,
    val country_id: Int? = null,
    val country_name: String? = null,
    val county_id: Int? = null,
    val county_name: String? = null,
    val create_time: String? = null,
    val create_user_id: Int? = null,
    val customer_number: String? = null,
    val customer_type_name: String? = null,
    val customer_user_id: Int? = null,
    val department_id: Int? = null,
    val department_name: String? = null,
    val detail_address: String? = null,
    val entry_type_name: String? = null,
    val id: Int? = null,
    val industry_name: String? = null,
    val mark: Int? = null,
    val name: String? = null,
    val owner_id: Int? = null,
    val owner_name: String? = null,
    val parent_id: Int? = null,
    val province_id: Int? = null,
    val province_name: String? = null,
    val safe_level: String? = null,
    val service_limit: Int? = null,
    val short_name: String? = null,
    val source: String? = null,
    val status: Int? = null,
    val tag_name: String? = null,
    val update_time: String? = null,
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeValue(city_id)
        parcel.writeString(city_name)
        parcel.writeString(contact_at)
        parcel.writeValue(country_id)
        parcel.writeString(country_name)
        parcel.writeValue(county_id)
        parcel.writeString(county_name)
        parcel.writeString(create_time)
        parcel.writeValue(create_user_id)
        parcel.writeString(customer_number)
        parcel.writeString(customer_type_name)
        parcel.writeValue(customer_user_id)
        parcel.writeValue(department_id)
        parcel.writeString(department_name)
        parcel.writeString(detail_address)
        parcel.writeString(entry_type_name)
        parcel.writeValue(id)
        parcel.writeString(industry_name)
        parcel.writeValue(mark)
        parcel.writeString(name)
        parcel.writeValue(owner_id)
        parcel.writeString(owner_name)
        parcel.writeValue(parent_id)
        parcel.writeValue(province_id)
        parcel.writeString(province_name)
        parcel.writeString(safe_level)
        parcel.writeValue(service_limit)
        parcel.writeString(short_name)
        parcel.writeString(source)
        parcel.writeValue(status)
        parcel.writeString(tag_name)
        parcel.writeString(update_time)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<Customer> {
        override fun createFromParcel(parcel: Parcel): Customer {
            return Customer(parcel)
        }

        override fun newArray(size: Int): Array<Customer?> {
            return arrayOfNulls(size)
        }
    }
}

